
// :]

#include "MyCPUFile.h"

int main()
{
    try
    {
        CPU cpu;

        FILE* input = fopen("Code.txt", "r");
        FILE* output = fopen("Code_.txt", "w");

        assemble(input, output);

        fclose(output);
        FILE* code = fopen("Code_.txt", "r");

        double result = cpu.run(code);

        fclose(input);
        fclose(code);

        cout << result;
    }
    catch(const char* exc)
    {
        $r cout << exc; $d
    }
    catch(exception exc)
    {
        cout << exc.what();
    }
    catch(...)
    {
        cout << "Shit happens!";
    }
}
